package com.example.wudi.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.wudi.res.Res;
import com.example.wudi.service.PermissionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/permissions/")
public class PermissionsController {

    @Autowired
    private PermissionsService permissionsService;

    @CrossOrigin
    @GetMapping("findAll")
    @SaCheckLogin
    @SaCheckPermission("permissions:select")
    public Res findAll() {
        return Res.okLit("", permissionsService.findAll());
    }
}
